<template>
  <div>
    <div>
      <el-row style="margin-bottom:10px">
        <el-col :span="8" >
          <h4 style="margin:0">
            <span>医院审核</span>
          </h4>
        </el-col>
        <el-col :span="16" style="text-align:right">
          
        </el-col>
      </el-row>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="全部" name="first">
          <my-info :tableData="tableData" @getlist="getlist"></my-info>
        </el-tab-pane>

        <el-tab-pane label="待审核" name="second">
          <my-info :tableData="tableData" @getlist="getlist"></my-info>
        </el-tab-pane>

        <el-tab-pane label="已审核" name="third">
          <my-info :tableData="tableData" @getlist="getlist"></my-info>
        </el-tab-pane>
      </el-tabs>
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="10"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </div>
    <el-dialog :visible.sync="showSta">
      <img width="100%" :src="showImgeUrl" alt="">
    </el-dialog>
  </div>
</template>

<script>
  import MyInfo from './Hositem/MyInfo'
  import Http from '@/Http/Http'
  import getTime from '@/Http/getTime'
  export default {
    data() {
      return {
        activeName: 'first',
        dialogVisible:false,
        showSta:false,
        showImgeUrl:'',
        total:0,
        navStatus:-1,
        currentPage4: 1,//分野  
        page:1,
        pageSize:10,
        tableData: [],
      }
    },
    components:{
      MyInfo
    },
    created(){
      this.getlist()
    },
    mounted() {
      var obj = document.getElementById('centerbox')
      obj.addEventListener('scroll', this.handleScroll,true)
    },
    destroyed(){
      var obj = document.getElementById('centerbox')
      obj.removeEventListener('scroll', this.handleScroll,true)
    },
    methods: {
      handleScroll() {
        var scollobj = document.getElementById('centerbox');
        var scrollTop = scollobj.scrollTop;
        const obj = document.getElementById('tab-first');
        const myobj = obj.parentNode.parentNode;
        if(scrollTop> 32){
          myobj.style.position = 'fixed';
          myobj.style.top = 0;
        } else {
          myobj.style.position = 'relative';
        }
      },
      getlist() {
        const param = {
          "pageIndex":this.page,
          "pageSize":this.pageSize
        };
        if (this.navStatus != -1){
          param.status = this.navStatus
        }
        Http.getHospitalManagerlist(param).then( res => {
          this.tableData = res.data.data.rows;
          this.total = res.data.data.total;
        })
        .catch( error => {
          
        })
      },
      
      colseFun(){
        this.dialogVisible = false;
      },
      showImage(row) {
        this.showImgeUrl = row ; 
        this.showSta = ture
      },
      
      handleClick(tab, event){
        this.navStatus = Number(tab.index) -1;
        this.page = 1;
        this.getlist()
      },
      
      //选择 推荐
      handleSelectionChange() {
        
      },
        //分页
      handleSizeChange(val) {
        this.pageSize = val;
        this.getlist()
        
      },
      handleCurrentChange(val) {
        this.page = val;
        this.getlist()
        
      },
    }
  }
</script>

<style>
.el-tabs__nav-wrap::after{
  width:0!important;
}
</style>